package demo;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * 向文件中写入一个字节
 */
public class HelloWorld {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new  FileOutputStream("fos.dat");
        String line ="一袋米要抗几楼！";
         fos.write(line.getBytes(StandardCharsets.UTF_8));
         line ="分支上写入的内容！";
         fos.write(line.getBytes(StandardCharsets.UTF_8));
         line ="主线上新添加了一句写入内容";
         fos.write(line.getBytes(StandardCharsets.UTF_8));
         line = "主线上再新添加一句！！！！";
         System.out.println("写出完毕");
         line = "分支上有添加了一句写入操作！！！！！！！！！！！";
         fos.write(line.getBytes(StandardCharsets.UTF_8));
        System.out.println("写出完毕");
         fos.close();
    }
}
